package org.bob.learn.service.impl;

import org.bob.learn.dao.entity.Hotel;
import org.bob.learn.dao.repository.HotelRepository;
import org.bob.learn.service.HotelService;
import org.springframework.stereotype.Service;

@Service
public class HotelServiceImpl implements HotelService {

    private final HotelRepository hotelRepository;

    public HotelServiceImpl(HotelRepository hotelRepository) {
        this.hotelRepository = hotelRepository;
    }

    @Override
    public void add(Hotel hotel) {
        hotelRepository.save(hotel);
    }

    @Override
    public Hotel qryById(String id) {
        return hotelRepository.findById(id).get();
    }
}
